# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         demo8_02
# Description:
# Author:       asus
# Date:         2019/3/14
#-------------------------------------------------------------------------------

# 方法和私有化
class MyClass:
# 公共方法
    def getName(self):
        return self.name

    def setName(self,name):
        self.name = name
        # 在内部可以直接调用私有方法
        self.__outName()

    def __outName(self):
        print("Name = {}".format(self.name))

myClass = MyClass()
import inspect
methods = inspect.getmembers(myClass,predicate=inspect.ismethod)
print(methods)# 输出类方法名称

for method in methods:
    print(method[0])
print("----------")
myClass.setName("Bill")
print(myClass.getName())
myClass._MyClass__outName()
print(myClass.__outName())


